$("#query").click(function(){
	
	$(".page").val("1")
	getAjax();
})

/*———————————————————————————————————————查看详情—————————————————————————————————————————————*/

$('.tableData').delegate(".viewDetail","click",function(){	
	var id=$(this).parent().prev().text();//获取当前订单状态的id值	
	layer.open({
		type: 2,
		title:false,
		closeBtn: 0,
		title:false,
		shadeClose: true,
		shade: [0.9,'#cfcfcf'],
		area: ['98%', '98%'],  
		content: ['../ak/embedDiv.html?id='+id],// iframe的url，no代表不显示滚动条
		end:function(){
			
		}
			
	});

})
/*———————————————————————————————————————订单号关联详情，点击订单号可查看详情—————————————————————————————————————————————*/

$('.tableData').delegate(".id_link","click",function(){	
	var id=$(this).next().text();//获取当前订单状态的id值	
	layer.open({
		type: 2,
		title:false,
		closeBtn: 0,
		title:false,
		shadeClose: true,
		shade: [0.9,'#cfcfcf'],
		area: ['98%', '98%'],  
		content: ['../ak/embedDiv.html?id='+id],// iframe的url，no代表不显示滚动条
		end:function(){
			
		}
			
	});

})

//__________________________________________________________________________________封装ajax
	var totalAmount
	var totalPage
	var nowPage
	function getAjax(){
		var fltNo = $(".fltNo").val();
		var prdCde = $(".prdCde").val();
		var startDate = $(".startDate").val();
		var endDate = $(".endDate").val();
		var interval = $(".interval").val();
		var pageNum = $(".page").val();
		var pageSize = $(".pageSize").val();
		if(fltNo==""&&prdCde==""&&startDate==""&&endDate==""&&interval==""){
			layer.msg("请输入产品编号或者其余四项查询条件",{icon:2,time:3500});
			return false;
		}else if(prdCde==""&&(fltNo==""||startDate==""||endDate==""||interval=="")){
			layer.msg("请输入产品编号或者其余四项查询条件",{icon:2,time:3500});
			return false;
		}
		$.ajax({
			type:"get",
			url:"../order/getConflictOrder?fltNo="+fltNo+"&interval="+interval+"&endDate="+endDate+"&startDate="+startDate+"&prdCde="+prdCde+"&pageNum="+pageNum+"&pageSize="+pageSize+"&temp="+Math.random(),
			dataType:"json",
			success:function(data){
				$(".clear").empty();
				if(data.status=="1002"){
					layer.alert(data.message);
					return false;
				}				
				if(data.data.total=="0"){
					layer.msg("无查询信息");
					return false;
				}				
				totalAmount = data.data.total
				totalPage = data.data.pages
				nowPage = data.data.pageNum
				//共多少条
				$(".totalAmount").text(totalAmount)
				//共多少页
				$(".totalPage").text(totalPage)
				//第几页
				$(".nowPage").text(nowPage)
			var str = "";
			for(var i=0;i<data.data.list.length;i++){
				var len = data.data.list[i].itineraries.length
				var doStr = "";
				if(data.data.list[i].status=="1"&&data.data.list[i].type=="3"){
					doStr = "<span class='viewDetail'>查看详情</span><span style='color:red;' class='cancleOrder'>取消订单</span>";
				}
				if(data.data.list[i].status=="1"&&data.data.list[i].type!="3"){
					doStr = "<span class='viewDetail'>查看详情</span>"
				}
				if(data.data.list[i].status=="2"){
					/*doStr = "<span class='upOrder'>更新票号</span>";*/
					doStr = "<span class='viewDetail'>查看详情</span>";
				}
				if(data.data.list[i].status=="3"){
					doStr = "<span class='viewDetail'>查看详情</span>";
				}
				if(data.data.list[i].status=="4"){
					doStr = "<span class='viewDetail'>查看详情</span>";
				}
				if(data.data.list[i].status=="5"){
					doStr = "<span class='viewDetail'>查看详情</span>";
				}
				for(var j=0;j<data.data.list[i].itineraries.length;j++){
					if(j==0){
						if(data.data.list[i].connect=="1"){           //联程图标与升舱图标
							if(data.data.list[i].seatUp=="1"){
								str+="<tr>" +								
								"<td class='connectImg id_link' rowspan="+len+"><span class=seatUpImg></span>"+data.data.list[i].id+"</td>"+
								"<td rowspan="+len+" style=display:none;>"+data.data.list[i].id+"</td>"+
								"<td rowspan="+len+"><span style=color:#00aa98;>"+commomFun.toEmptyString(data.data.list[i].purchaseName)+"</span></br>"+data.data.list[i].customer+"</td>"
							}else{
								str+="<tr>" +								
								"<td class='connectImg id_link' rowspan="+len+">"+data.data.list[i].id+"</td>"+
								"<td rowspan="+len+" style=display:none;>"+data.data.list[i].id+"</td>"+
								"<td rowspan="+len+"><span style=color:#00aa98;>"+commomFun.toEmptyString(data.data.list[i].purchaseName)+"</span></br>"+data.data.list[i].customer+"</td>"								
							}
						   
						}else{
							if(data.data.list[i].seatUp=="1"){
								str+="<tr>" +
								"<td class='id_link' rowspan="+len+"><span class=seatUpImg></span>"+data.data.list[i].id+"</td>"+
								"<td rowspan="+len+" style=display:none;>"+data.data.list[i].id+"</td>"+
								"<td rowspan="+len+"><span style=color:#00aa98;>"+commomFun.toEmptyString(data.data.list[i].purchaseName)+"</span></br>"+data.data.list[i].customer+"</td>"
							}else{
								str+="<tr>" +
								"<td class='id_link' rowspan="+len+">"+data.data.list[i].id+"</td>"+
								"<td rowspan="+len+" style=display:none;>"+data.data.list[i].id+"</td>"+
								"<td rowspan="+len+"><span style=color:#00aa98;>"+commomFun.toEmptyString(data.data.list[i].purchaseName)+"</span></br>"+data.data.list[i].customer+"</td>"
							}
						   
						}
					}
																										
						str+=   "<td>"+data.data.list[i].itineraries[j].flightNumber+"</td>"+
								"<td>"+data.data.list[i].itineraries[j].departureAirport+" ("+data.data.list[i].itineraries[j].departureAirportCode+") <span style='color:red;'>"+data.data.list[i].itineraries[j].departureAirportTerminal+"</span></br><span style=color:#00aa98;>"+data.data.list[i].itineraries[j].departureDate+"&nbsp;&nbsp;"+data.data.list[i].itineraries[j].departureTime+"</span></td>"+
								"<td>"+data.data.list[i].itineraries[j].arriveAirport+" ("+data.data.list[i].itineraries[j].arriveAirportCode+") <span style='color:red;'>"+data.data.list[i].itineraries[j].arriveAirportTerminal+"</span></br><span style=color:#00aa98;>"+data.data.list[i].itineraries[j].arriveAirportDate+"&nbsp;&nbsp;"+ data.data.list[i].itineraries[j].arriveAirportTime+"</span></td>"
					if(j==0){
						str+=   "<td rowspan="+len+">"+commomFun.cabinStatusStr(data.data.list[i].itineraries[j].seatClass)+"</td>"+
								"<td rowspan="+len+"><span style=color:#ff7777;>"+data.data.list[i].realPassengerTotal+"</span>/"+data.data.list[i].passengerTotal+"</td>"+
								"<td rowspan="+len+">"+commomFun.orderStatusStr(data.data.list[i].status)+"</td>"+
								"<td rowspan="+len+" style=display:none;>"+data.data.list[i].id+"</td>"+
								"<td class=doStr rowspan="+len+">"+doStr+"</td>"
							
					}
						str+="</tr>"
							
				}	
				
			}
			$(".clear").append(str)
			}
		})								
	}

//________________________________________表头固定____________________________________________
	$("#dataTable").freezeHeader();
//________________________________________分页__________________________________
	$(".Pagination").load("Pagination.html",function(){
		
	})






















